import autoMessages from '@intlify/unplugin-vue-i18n/messages'

import { createI18n } from 'vue-i18n'
import { en, zhHans } from 'vuetify/locale'
import { systemState } from 'global-state'

const messages = {
  en: {
    ...autoMessages?.en,
    $vuetify: {
      ...en
    }
  },
  zhHans: {
    ...autoMessages?.zhHans,
    $vuetify: {
      ...zhHans
    }
  }
}

const i18n = createI18n<false>({
  locale: systemState.state.language,
  fallbackLocale: 'en',
  warnHtmlMessage: false,
  escapeParameterHtml: true,
  messages
})

export default i18n
